from dingtalkchatbot.chatbot import DingtalkChatbot
import datetime


def send_message(message):
    webhook = 'https://oapi.dingtalk.com/robot/send?access_token=c09136d67abf2439e4e84e2df226e245bb6ccba15c79f5865957ef8ce1717e4f'
    xiaoding = DingtalkChatbot(webhook)

    now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

    message = '报警' + ' ' + now_time + '\n' + message

    xiaoding.send_text(msg=message, is_at_all=False)

if __name__ == '__main__':
    message = '测试'
    send_message(message)